package org.com.f4.controller;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.com.f4.model.Page;
import org.com.f4.service.IWineproductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/role")
public class RoleAction {
	@Autowired
	IWineproductService iWineproductService;
	/**
	 * index
	 * @return
	 */
	@RequestMapping(value="/index")
	public String  login(){
		return "role/role";
	}
	@RequestMapping(value="/index1")
	public String  login1(){
		return "role/role1";
	}
	@RequestMapping(value="/index2")
	public String  login2(){
		return "role/role2";
	}
	@RequestMapping(value="/index3")
	public String  login3(){
		return "role/role3";
	}
	@RequestMapping(value="/index4")
	public String  login4(){
		return "role/role4";
	}
	@RequestMapping(value="/index5")
	public String  login5(){
		return "role/role5";
	}
	
	
	@RequestMapping(value = "/json1")
	@ResponseBody
	public Map<String,Object> Login(Integer iDisplayStart, Integer iDisplayLength)
			throws UnsupportedEncodingException {
		System.out.println("**********"+iDisplayStart);
		if (iDisplayStart == null) {
			iDisplayStart = 0;
		};
		if (iDisplayLength == null){
			iDisplayLength = 3;
		};
		Page page=new Page();
		page.setPageNum(iDisplayStart);
		page.setPageSize(iDisplayLength);
		page=iWineproductService.findWin(page);
		System.out.println(page);
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("aaData", page.getList());//返回的数据
		map.put("iTotalRecords", page.getTotal());//总条数
		map.put("iTotalDisplayRecords", page.getTotal());////总条数
		return map;
	}
	@RequestMapping(value = "/json2")
	@ResponseBody
	public Map<String,Object> Login2(Integer iDisplayStart, Integer iDisplayLength)
			throws UnsupportedEncodingException {
		System.out.println("**********"+iDisplayStart);
		if (iDisplayStart == null) {
			iDisplayStart = 0;
		};
		if (iDisplayLength == null){
			iDisplayLength = 3;
		};
		Page page=new Page();
		page.setPageNum(iDisplayStart);
		page.setPageSize(iDisplayLength);
		page=iWineproductService.findWin1(page);
		System.out.println(page);
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("aaData", page.getList());//返回的数据
		map.put("iTotalRecords", page.getTotal());//总条数
		map.put("iTotalDisplayRecords", page.getTotal());////总条数
		return map;
	}@RequestMapping(value = "/json3")
	@ResponseBody
	public Map<String,Object> Login3(Integer iDisplayStart, Integer iDisplayLength)
			throws UnsupportedEncodingException {
		System.out.println("**********"+iDisplayStart);
		if (iDisplayStart == null) {
			iDisplayStart = 0;
		};
		if (iDisplayLength == null){
			iDisplayLength = 3;
		};
		Page page=new Page();
		page.setPageNum(iDisplayStart);
		page.setPageSize(iDisplayLength);
		page=iWineproductService.findWin2(page);
		System.out.println(page);
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("aaData", page.getList());//返回的数据
		map.put("iTotalRecords", page.getTotal());//总条数
		map.put("iTotalDisplayRecords", page.getTotal());////总条数
		return map;
	}@RequestMapping(value = "/json4")
	@ResponseBody
	public Map<String,Object> Login4(Integer iDisplayStart, Integer iDisplayLength)
			throws UnsupportedEncodingException {
		System.out.println("**********"+iDisplayStart);
		if (iDisplayStart == null) {
			iDisplayStart = 0;
		};
		if (iDisplayLength == null){
			iDisplayLength = 3;
		};
		Page page=new Page();
		page.setPageNum(iDisplayStart);
		page.setPageSize(iDisplayLength);
		page=iWineproductService.findWin3(page);
		System.out.println(page);
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("aaData", page.getList());//返回的数据
		map.put("iTotalRecords", page.getTotal());//总条数
		map.put("iTotalDisplayRecords", page.getTotal());////总条数
		return map;
	}@RequestMapping(value = "/json5")
	@ResponseBody
	public Map<String,Object> Login5(Integer iDisplayStart, Integer iDisplayLength)
			throws UnsupportedEncodingException {
		System.out.println("**********"+iDisplayStart);
		if (iDisplayStart == null) {
			iDisplayStart = 0;
		};
		if (iDisplayLength == null){
			iDisplayLength = 3;
		};
		Page page=new Page();
		page.setPageNum(iDisplayStart);
		page.setPageSize(iDisplayLength);
		page=iWineproductService.findWin4(page);
		System.out.println(page);
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("aaData", page.getList());//返回的数据
		map.put("iTotalRecords", page.getTotal());//总条数
		map.put("iTotalDisplayRecords", page.getTotal());////总条数
		return map;
	}@RequestMapping(value = "/json6")
	@ResponseBody
	public Map<String,Object> Login6(Integer iDisplayStart, Integer iDisplayLength)
			throws UnsupportedEncodingException {
		System.out.println("**********"+iDisplayStart);
		if (iDisplayStart == null) {
			iDisplayStart = 0;
		};
		if (iDisplayLength == null){
			iDisplayLength = 3;
		};
		Page page=new Page();
		page.setPageNum(iDisplayStart);
		page.setPageSize(iDisplayLength);
		page=iWineproductService.findWin5(page);
		System.out.println(page);
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("aaData", page.getList());//返回的数据
		map.put("iTotalRecords", page.getTotal());//总条数
		map.put("iTotalDisplayRecords", page.getTotal());////总条数
		return map;
	}
	
	
	
	

	
	
	
	}